1BASH_BUILTINS(1)            General Commands Manual           BASH_BUILTINS(1)
2
3
4

NAME

6       bash,  :,  ., [, alias, bg, bind, break, builtin, cd, command, compgen,
7       complete, continue, declare, dirs, disown, echo,  enable,  eval,  exec,
8       exit,  export,  fc,  fg, getopts, hash, help, history, jobs, kill, let,
9       local, logout, popd, printf, pushd, pwd, read, readonly,  return,  set,
10       shift,  shopt,  source,  suspend,  test,  times,  trap,  type, typeset,
11       ulimit, umask, unalias, unset,  wait  -  bash  built-in  commands,  see
12       bash(1)
13

BASH BUILTIN COMMANDS

15       Unless otherwise noted, each builtin command documented in this section
16       as accepting options preceded by - accepts -- to signify the end of the
17       options.   For  example,  the  :, true, false, and test builtins do not
18       accept options.
19       : [arguments]
20              No effect; the command does nothing beyond  expanding  arguments
21              and  performing any specified redirections.  A zero exit code is
22              returned.
23
24        .  filename [arguments]
25       source filename [arguments]
26              Read and execute commands from filename  in  the  current  shell
27              environment  and return the exit status of the last command exe‐
28              cuted from filename.  If filename does not contain a slash, file
29              names  in  PATH  are used to find the directory containing file‐
30              name.  The file searched for in PATH  need  not  be  executable.
31              When  bash  is  not  in  posix  mode,  the  current directory is
32              searched if no file is found in PATH.  If the sourcepath  option
33              to  the  shopt  builtin  command  is turned off, the PATH is not
34              searched.  If any arguments are supplied, they become the  posi‐
35              tional  parameters  when  filename  is  executed.  Otherwise the
36              positional parameters are unchanged.  The return status  is  the
37              status  of  the  last  command exited within the script (0 if no
38              commands are executed), and false if filename is  not  found  or
39              cannot be read.
40
41       alias [-p] [name[=value] ...]
42              Alias with no arguments or with the -p option prints the list of
43              aliases in the form alias name=value on standard  output.   When
44              arguments  are supplied, an alias is defined for each name whose
45              value is given.  A trailing space in  value causes the next word
46              to be checked for alias substitution when the alias is expanded.
47              For each name in the argument list for which no  value  is  sup‐
48              plied,  the  name  and  value  of  the  alias is printed.  Alias
49              returns true unless a name is given for which no alias has  been
50              defined.
51
52       bg [jobspec ...]
53              Resume  each  suspended  job jobspec in the background, as if it
54              had been started with &.  If jobspec is not present, the shell's
55              notion  of the current job is used.  bg jobspec returns 0 unless
56              run when job control is disabled or, when run with  job  control
57              enabled,  any  specified  jobspec  was  not found or was started
58              without job control.
59
60       bind [-m keymap] [-lpsvPSV]
61       bind [-m keymap] [-q function] [-u function] [-r keyseq]
62       bind [-m keymap] -f filename
63       bind [-m keymap] -x keyseq:shell-command
64       bind [-m keymap] keyseq:function-name
65       bind readline-command
66              Display current readline key and function bindings, bind  a  key
67              sequence  to  a  readline  function  or macro, or set a readline
68              variable.  Each non-option argument is a  command  as  it  would
69              appear  in  .inputrc, but each binding or command must be passed
70              as a separate argument; e.g.,  '"\C-x\C-r":  re-read-init-file'.
71              Options, if supplied, have the following meanings:
72              -m keymap
73                     Use keymap as the keymap to be affected by the subsequent
74                     bindings.  Acceptable keymap names are emacs, emacs-stan‐
75                     dard,  emacs-meta,  emacs-ctlx,  vi, vi-move, vi-command,
76                     and vi-insert.  vi is equivalent to vi-command; emacs  is
77                     equivalent to emacs-standard.
78              -l     List the names of all readline functions.
79              -p     Display  readline  function  names and bindings in such a
80                     way that they can be re-read.
81              -P     List current readline function names and bindings.
82              -v     Display readline variable names and values in such a  way
83                     that they can be re-read.
84              -V     List current readline variable names and values.
85              -s     Display  readline  key  sequences bound to macros and the
86                     strings they output in such a way that they  can  be  re-
87                     read.
88              -S     Display  readline  key  sequences bound to macros and the
89                     strings they output.
90              -f filename
91                     Read key bindings from filename.
92              -q function
93                     Query about which keys invoke the named function.
94              -u function
95                     Unbind all keys bound to the named function.
96              -r keyseq
97                     Remove any current binding for keyseq.
98              -x keyseq:shell-command
99                     Cause shell-command to be  executed  whenever  keyseq  is
100                     entered.
101
102              The  return value is 0 unless an unrecognized option is given or
103              an error occurred.
104
105       break [n]
106              Exit from within a for, while, until, or select loop.  If  n  is
107              specified, break n levels.  n must be ≥ 1.  If n is greater than
108              the number of enclosing loops, all enclosing loops  are  exited.
109              The  return  value is 0 unless the shell is not executing a loop
110              when break is executed.
111
112       builtin shell-builtin [arguments]
113              Execute the specified shell builtin, passing it  arguments,  and
114              return its exit status.  This is useful when defining a function
115              whose name is the same as a shell builtin, retaining  the  func‐
116              tionality of the builtin within the function.  The cd builtin is
117              commonly redefined this way.  The  return  status  is  false  if
118              shell-builtin is not a shell builtin command.
119
120       cd [-L|-P] [dir]
121              Change  the  current directory to dir.  The variable HOME is the
122              default dir.  The variable CDPATH defines the  search  path  for
123              the  directory  containing  dir.  Alternative directory names in
124              CDPATH are separated by a colon (:).  A null directory  name  in
125              CDPATH  is  the  same as the current directory, i.e., ``.''.  If
126              dir begins with a slash (/), then CDPATH is  not  used.  The  -P
127              option  says  to use the physical directory structure instead of
128              following symbolic links (see also the  -P  option  to  the  set
129              builtin command); the -L option forces symbolic links to be fol‐
130              lowed.  An argument of - is equivalent to $OLDPWD.   If  a  non-
131              empty  directory  name from CDPATH is used, or if - is the first
132              argument, and the directory change is successful,  the  absolute
133              pathname of the new working directory is written to the standard
134              output.  The return value is true if the directory was  success‐
135              fully changed; false otherwise.
136
137       caller [expr]
138              Returns the context of any active subroutine call (a shell func‐
139              tion or a script executed with the . or source builtins.   With‐
140              out expr, caller displays the line number and source filename of
141              the current subroutine call.  If a non-negative integer is  sup‐
142              plied as expr, caller displays the line number, subroutine name,
143              and source file corresponding to that position  in  the  current
144              execution  call  stack.  This extra information may be used, for
145              example, to print a stack trace.  The current frame is frame  0.
146              The  return  value is 0 unless the shell is not executing a sub‐
147              routine call or expr does not correspond to a valid position  in
148              the call stack.
149
150       command [-pVv] command [arg ...]
151              Run  command  with  args  suppressing  the normal shell function
152              lookup. Only builtin commands or commands found in the PATH  are
153              executed.   If the -p option is given, the search for command is
154              performed using a default value for PATH that is  guaranteed  to
155              find  all  of  the  standard  utilities.  If either the -V or -v
156              option is supplied, a description of command is printed.  The -v
157              option  causes a single word indicating the command or file name
158              used to invoke command to be displayed; the -V option produces a
159              more  verbose  description.  If the -V or -v option is supplied,
160              the exit status is 0 if command was found, and  1  if  not.   If
161              neither option is supplied and an error occurred or command can‐
162              not be found, the exit status is 127.  Otherwise, the exit  sta‐
163              tus of the command builtin is the exit status of command.
164
165       compgen [option] [word]
166              Generate  possible  completion matches for word according to the
167              options, which may  be  any  option  accepted  by  the  complete
168              builtin  with  the exception of -p and -r, and write the matches
169              to the standard output.  When using the -F or  -C  options,  the
170              various  shell  variables  set  by  the  programmable completion
171              facilities, while available, will not have useful values.
172
173              The matches will be generated in the same way as if the program‐
174              mable completion code had generated them directly from a comple‐
175              tion specification with the same flags.  If word  is  specified,
176              only those completions matching word will be displayed.
177
178              The  return  value is true unless an invalid option is supplied,
179              or no matches were generated.
180
181       complete [-abcdefgjksuv] [-o comp-option] [-A action] [-G globpat]  [-W
182       wordlist] [-P prefix] [-S suffix]
183              [-X filterpat] [-F function] [-C command] name [name ...]
184       complete -pr [name ...]
185              Specify  how arguments to each name should be completed.  If the
186              -p option is supplied, or if no options are  supplied,  existing
187              completion  specifications are printed in a way that allows them
188              to be reused as input.  The -r option removes a completion spec‐
189              ification  for each name, or, if no names are supplied, all com‐
190              pletion specifications.
191
192              The process of applying  these  completion  specifications  when
193              word  completion  is attempted is described above under Program‐
194              mable Completion.
195
196              Other options, if specified, have the following  meanings.   The
197              arguments  to the -G, -W, and -X options (and, if necessary, the
198              -P and -S options) should be quoted to protect them from  expan‐
199              sion before the complete builtin is invoked.
200              -o comp-option
201                      The  comp-option  controls  several aspects of the comp‐
202                      spec's behavior beyond the simple generation of  comple‐
203                      tions.  comp-option may be one of:
204                      bashdefault
205                              Perform the rest of the default bash completions
206                              if the compspec generates no matches.
207                      default Use readline's default  filename  completion  if
208                              the compspec generates no matches.
209                      dirnames
210                              Perform  directory  name completion if the comp‐
211                              spec generates no matches.
212                      filenames
213                              Tell readline that the compspec generates  file‐
214                              names,  so  it can perform any filename-specific
215                              processing (like adding  a  slash  to  directory
216                              names or suppressing trailing spaces).  Intended
217                              to be used with shell functions.
218                      nospace Tell  readline  not  to  append  a  space   (the
219                              default)  to  words  completed at the end of the
220                              line.
221                      plusdirs
222                              After any matches defined by  the  compspec  are
223                              generated,    directory   name   completion   is
224                              attempted and  any  matches  are  added  to  the
225                              results of the other actions.
226              -A action
227                      The  action  may  be  one of the following to generate a
228                      list of possible completions:
229                      alias   Alias names.  May also be specified as -a.
230                      arrayvar
231                              Array variable names.
232                      binding Readline key binding names.
233                      builtin Names of shell builtin commands.   May  also  be
234                              specified as -b.
235                      command Command names.  May also be specified as -c.
236                      directory
237                              Directory names.  May also be specified as -d.
238                      disabled
239                              Names of disabled shell builtins.
240                      enabled Names of enabled shell builtins.
241                      export  Names  of exported shell variables.  May also be
242                              specified as -e.
243                      file    File names.  May also be specified as -f.
244                      function
245                              Names of shell functions.
246                      group   Group names.  May also be specified as -g.
247                      helptopic
248                              Help topics as accepted by the help builtin.
249                      hostname
250                              Hostnames, as taken from the file  specified  by
251                              the HOSTFILE shell variable.
252                      job     Job  names,  if job control is active.  May also
253                              be specified as -j.
254                      keyword Shell reserved words.  May also be specified  as
255                              -k.
256                      running Names of running jobs, if job control is active.
257                      service Service names.  May also be specified as -s.
258                      setopt  Valid  arguments  for  the  -o option to the set
259                              builtin.
260                      shopt   Shell option names  as  accepted  by  the  shopt
261                              builtin.
262                      signal  Signal names.
263                      stopped Names of stopped jobs, if job control is active.
264                      user    User names.  May also be specified as -u.
265                      variable
266                              Names of all shell variables.  May also be spec‐
267                              ified as -v.
268              -G globpat
269                      The filename expansion pattern globpat  is  expanded  to
270                      generate the possible completions.
271              -W wordlist
272                      The  wordlist  is  split using the characters in the IFS
273                      special variable as delimiters, and each resultant  word
274                      is  expanded.   The possible completions are the members
275                      of the resultant list which match the  word  being  com‐
276                      pleted.
277              -C command
278                      command  is  executed in a subshell environment, and its
279                      output is used as the possible completions.
280              -F function
281                      The shell function function is executed in  the  current
282                      shell  environment.  When it finishes, the possible com‐
283                      pletions are retrieved from the value of  the  COMPREPLY
284                      array variable.
285              -X filterpat
286                      filterpat  is  a pattern as used for filename expansion.
287                      It is applied to the list of possible completions gener‐
288                      ated  by  the  preceding options and arguments, and each
289                      completion matching filterpat is removed from the  list.
290                      A  leading  !  in filterpat negates the pattern; in this
291                      case, any completion not matching filterpat is removed.
292              -P prefix
293                      prefix is added at the beginning of each  possible  com‐
294                      pletion after all other options have been applied.
295              -S suffix
296                      suffix is appended to each possible completion after all
297                      other options have been applied.
298
299              The return value is true unless an invalid option  is  supplied,
300              an  option  other than -p or -r is supplied without a name argu‐
301              ment, an attempt is made to remove  a  completion  specification
302              for a name for which no specification exists, or an error occurs
303              adding a completion specification.
304
305       continue [n]
306              Resume the next iteration of the enclosing for, while, until, or
307              select  loop.   If  n  is specified, resume at the nth enclosing
308              loop.  n must be ≥ 1.  If  n  is  greater  than  the  number  of
309              enclosing  loops,  the  last  enclosing  loop (the ``top-level''
310              loop) is resumed.  The return value is 0 unless the shell is not
311              executing a loop when continue is executed.
312
313       declare [-afFirtx] [-p] [name[=value] ...]
314       typeset [-afFirtx] [-p] [name[=value] ...]
315              Declare  variables and/or give them attributes.  If no names are
316              given then display the values of variables.  The -p option  will
317              display  the  attributes  and  values  of each name.  When -p is
318              used, additional options are ignored.  The  -F  option  inhibits
319              the  display of function definitions; only the function name and
320              attributes are printed.  If the extdebug shell option is enabled
321              using  shopt,  the  source  file  name and line number where the
322              function is defined  are  displayed  as  well.   The  -F  option
323              implies  -f.  The following options can be used to restrict out‐
324              put to variables with the specified attribute or to  give  vari‐
325              ables attributes:
326              -a     Each name is an array variable (see Arrays above).
327              -f     Use function names only.
328              -i     The variable is treated as an integer; arithmetic evalua‐
329                     tion (see ARITHMETIC EVALUATION ) is performed  when  the
330                     variable is assigned a value.
331              -r     Make names readonly.  These names cannot then be assigned
332                     values by subsequent assignment statements or unset.
333              -t     Give each name the  trace  attribute.   Traced  functions
334                     inherit  the  DEBUG  and  RETURN  traps  from the calling
335                     shell.  The trace attribute has no  special  meaning  for
336                     variables.
337              -x     Mark  names  for  export  to  subsequent commands via the
338                     environment.
339
340              Using `+' instead of `-' turns off the attribute  instead,  with
341              the  exception that +a may not be used to destroy an array vari‐
342              able.  When used in a function, makes each name local,  as  with
343              the  local  command.   If a variable name is followed by =value,
344              the value of the variable is set to value.  The return value  is
345              0 unless an invalid option is encountered, an attempt is made to
346              define a function using ``-f foo=bar'', an attempt  is  made  to
347              assign  a  value  to  a readonly variable, an attempt is made to
348              assign a value to an array variable without using  the  compound
349              assignment  syntax (see Arrays above), one of the names is not a
350              valid shell variable name, an attempt is made to turn off  read‐
351              only  status for a readonly variable, an attempt is made to turn
352              off array status for an array variable, or an attempt is made to
353              display a non-existent function with -f.
354
355       dirs [-clpv] [+n] [-n]
356              Without  options,  displays  the  list  of  currently remembered
357              directories.  The default display  is  on  a  single  line  with
358              directory  names  separated by spaces.  Directories are added to
359              the list with  the  pushd  command;  the  popd  command  removes
360              entries from the list.
361              +n     Displays the nth entry counting from the left of the list
362                     shown by dirs when invoked without options, starting with
363                     zero.
364              -n     Displays  the  nth  entry  counting from the right of the
365                     list shown by dirs when invoked without options, starting
366                     with zero.
367              -c     Clears  the  directory  stack  by  deleting  all  of  the
368                     entries.
369              -l     Produces a longer listing;  the  default  listing  format
370                     uses a tilde to denote the home directory.
371              -p     Print the directory stack with one entry per line.
372              -v     Print  the  directory stack with one entry per line, pre‐
373                     fixing each entry with its index in the stack.
374
375              The return value is 0 unless an invalid option is supplied or  n
376              indexes beyond the end of the directory stack.
377
378       disown [-ar] [-h] [jobspec ...]
379              Without  options,  each  jobspec  is  removed  from the table of
380              active jobs.  If the -h option is given,  each  jobspec  is  not
381              removed from the table, but is marked so that SIGHUP is not sent
382              to the job if the shell receives a SIGHUP.   If  no  jobspec  is
383              present,  and  neither the -a nor the -r option is supplied, the
384              current job is used.  If no jobspec is supplied, the  -a  option
385              means  to  remove or mark all jobs; the -r option without a job‐
386              spec argument restricts operation to running jobs.   The  return
387              value is 0 unless a jobspec does not specify a valid job.
388
389       echo [-neE] [arg ...]
390              Output  the  args,  separated  by spaces, followed by a newline.
391              The return status is always 0.  If -n is specified, the trailing
392              newline  is  suppressed.  If the -e option is given, interpreta‐
393              tion of the following backslash-escaped characters  is  enabled.
394              The  -E option disables the interpretation of these escape char‐
395              acters, even on systems where they are interpreted  by  default.
396              The  xpg_echo  shell option may be used to dynamically determine
397              whether or not echo expands these escape characters by  default.
398              echo  does  not  interpret  -- to mean the end of options.  echo
399              interprets the following escape sequences:
400              \a     alert (bell)
401              \b     backspace
402              \c     suppress trailing newline
403              \e     an escape character
404              \f     form feed
405              \n     new line
406              \r     carriage return
407              \t     horizontal tab
408              \v     vertical tab
409              \\     backslash
410              \0nnn  the eight-bit character whose value is  the  octal  value
411                     nnn (zero to three octal digits)
412              \xHH   the  eight-bit  character  whose value is the hexadecimal
413                     value HH (one or two hex digits)
414
415       enable [-adnps] [-f filename] [name ...]
416              Enable and disable builtin shell commands.  Disabling a  builtin
417              allows a disk command which has the same name as a shell builtin
418              to be executed without specifying a full pathname,  even  though
419              the  shell  normally searches for builtins before disk commands.
420              If -n is used, each  name  is  disabled;  otherwise,  names  are
421              enabled.  For example, to use the test binary found via the PATH
422              instead of the shell builtin version, run  ``enable  -n  test''.
423              The  -f  option  means to load the new builtin command name from
424              shared object filename, on systems that support dynamic loading.
425              The  -d  option will delete a builtin previously loaded with -f.
426              If no name arguments are given, or if the -p option is supplied,
427              a list of shell builtins is printed.  With no other option argu‐
428              ments, the list consists of all enabled shell builtins.   If  -n
429              is  supplied, only disabled builtins are printed.  If -a is sup‐
430              plied, the list printed includes all builtins, with  an  indica‐
431              tion  of whether or not each is enabled.  If -s is supplied, the
432              output is restricted to the POSIX special builtins.  The  return
433              value  is  0 unless a name is not a shell builtin or there is an
434              error loading a new builtin from a shared object.
435
436       eval [arg ...]
437              The args are read and concatenated together into a  single  com‐
438              mand.   This command is then read and executed by the shell, and
439              its exit status is returned as the value of eval.  If there  are
440              no args, or only null arguments, eval returns 0.
441
442       exec [-cl] [-a name] [command [arguments]]
443              If  command is specified, it replaces the shell.  No new process
444              is created.  The arguments become the arguments to command.   If
445              the -l option is supplied, the shell places a dash at the begin‐
446              ning of the zeroth arg passed to command.  This is what login(1)
447              does.  The -c option causes command to be executed with an empty
448              environment.  If -a is supplied, the shell passes  name  as  the
449              zeroth  argument  to the executed command.  If command cannot be
450              executed for some reason, a non-interactive shell exits,  unless
451              the  shell  option execfail is enabled, in which case it returns
452              failure.  An interactive shell returns failure if the file  can‐
453              not  be executed.  If command is not specified, any redirections
454              take effect in the current shell, and the return  status  is  0.
455              If there is a redirection error, the return status is 1.
456
457       exit [n]
458              Cause  the  shell  to exit with a status of n.  If n is omitted,
459              the exit status is that of the last command executed.  A trap on
460              EXIT is executed before the shell terminates.
461
462       export [-fn] [name[=word]] ...
463       export -p
464              The  supplied names are marked for automatic export to the envi‐
465              ronment of subsequently executed commands.  If the -f option  is
466              given,  the names refer to functions.  If no names are given, or
467              if the -p option is supplied, a  list  of  all  names  that  are
468              exported  in  this  shell  is printed.  The -n option causes the
469              export property to be removed from each  name.   If  a  variable
470              name  is  followed by =word, the value of the variable is set to
471              word.  export returns an exit status  of  0  unless  an  invalid
472              option  is  encountered,  one  of the names is not a valid shell
473              variable name, or -f is supplied with a name that is not a func‐
474              tion.
475
476       fc [-e ename] [-nlr] [first] [last]
477       fc -s [pat=rep] [cmd]
478              Fix  Command.  In the first form, a range of commands from first
479              to last is selected from the history list.  First and  last  may
480              be  specified  as a string (to locate the last command beginning
481              with that string) or as a number  (an  index  into  the  history
482              list, where a negative number is used as an offset from the cur‐
483              rent command number).  If last is not specified it is set to the
484              current  command  for  listing (so that ``fc -l -10'' prints the
485              last 10 commands) and to first otherwise.  If first is not spec‐
486              ified  it is set to the previous command for editing and -16 for
487              listing.
488
489              The -n option suppresses the command numbers when listing.   The
490              -r  option reverses the order of the commands.  If the -l option
491              is given, the commands are listed on  standard  output.   Other‐
492              wise,  the editor given by ename is invoked on a file containing
493              those commands.  If ename is not given, the value of the  FCEDIT
494              variable  is used, and the value of EDITOR if FCEDIT is not set.
495              If neither variable is set, is used.  When editing is  complete,
496              the edited commands are echoed and executed.
497
498              In  the  second form, command is re-executed after each instance
499              of pat is replaced by rep.  A useful alias to use with  this  is
500              ``r="fc  -s"'',  so  that  typing ``r cc'' runs the last command
501              beginning with ``cc'' and typing ``r'' re-executes the last com‐
502              mand.
503
504              If  the  first  form  is  used,  the return value is 0 unless an
505              invalid option is encountered or first or last  specify  history
506              lines  out  of  range.  If the -e option is supplied, the return
507              value is the value of the last command executed or failure if an
508              error occurs with the temporary file of commands.  If the second
509              form is used, the return status is that of the  command  re-exe‐
510              cuted,  unless  cmd  does  not  specify a valid history line, in
511              which case fc returns failure.
512
513       fg [jobspec]
514              Resume jobspec in the foreground, and make it the  current  job.
515              If jobspec is not present, the shell's notion of the current job
516              is used.  The return value is that of the  command  placed  into
517              the  foreground,  or failure if run when job control is disabled
518              or, when run with job control enabled, if jobspec does not spec‐
519              ify  a  valid  job  or  jobspec specifies a job that was started
520              without job control.
521
522       getopts optstring name [args]
523              getopts is used by shell procedures to parse positional  parame‐
524              ters.   optstring  contains  the  option characters to be recog‐
525              nized; if a character is followed by  a  colon,  the  option  is
526              expected  to have an argument, which should be separated from it
527              by white space.  The colon and question mark characters may  not
528              be  used as option characters.  Each time it is invoked, getopts
529              places the next option in the shell variable name,  initializing
530              name if it does not exist, and the index of the next argument to
531              be processed into the variable OPTIND.  OPTIND is initialized to
532              1  each  time  the  shell or a shell script is invoked.  When an
533              option requires an argument, getopts places that  argument  into
534              the  variable OPTARG.  The shell does not reset OPTIND automati‐
535              cally; it must be  manually  reset  between  multiple  calls  to
536              getopts within the same shell invocation if a new set of parame‐
537              ters is to be used.
538
539              When the end of options is encountered,  getopts  exits  with  a
540              return  value  greater than zero.  OPTIND is set to the index of
541              the first non-option argument, and name is set to ?.
542
543              getopts normally parses the positional parameters, but  if  more
544              arguments are given in args, getopts parses those instead.
545
546              getopts  can  report errors in two ways.  If the first character
547              of optstring is a colon, silent error  reporting  is  used.   In
548              normal  operation  diagnostic  messages are printed when invalid
549              options or missing option arguments  are  encountered.   If  the
550              variable  OPTERR  is  set  to  0, no error messages will be dis‐
551              played, even if the first character of optstring is not a colon.
552
553              If an invalid option is seen, getopts places ? into name and, if
554              not  silent,  prints  an  error  message  and unsets OPTARG.  If
555              getopts is silent, the  option  character  found  is  placed  in
556              OPTARG and no diagnostic message is printed.
557
558              If  a required argument is not found, and getopts is not silent,
559              a question mark (?) is placed in name, OPTARG is  unset,  and  a
560              diagnostic  message  is  printed.   If getopts is silent, then a
561              colon (:) is placed in name and OPTARG  is  set  to  the  option
562              character found.
563
564              getopts  returns true if an option, specified or unspecified, is
565              found.  It returns false if the end of options is encountered or
566              an error occurs.
567
568       hash [-lr] [-p filename] [-dt] [name]
569              For  each  name, the full file name of the command is determined
570              by searching the directories in $PATH and remembered.  If the -p
571              option is supplied, no path search is performed, and filename is
572              used as the full file name of the command.  The -r option causes
573              the  shell  to  forget  all remembered locations.  The -d option
574              causes the shell to forget the remembered location of each name.
575              If  the  -t  option is supplied, the full pathname to which each
576              name corresponds is printed.  If  multiple  name  arguments  are
577              supplied  with  -t,  the  name is printed before the hashed full
578              pathname.  The -l option causes output to be displayed in a for‐
579              mat  that may be reused as input.  If no arguments are given, or
580              if only -l is supplied, information about remembered commands is
581              printed.   The  return status is true unless a name is not found
582              or an invalid option is supplied.
583
584       help [-s] [pattern]
585              Display helpful information about builtin commands.  If  pattern
586              is  specified, help gives detailed help on all commands matching
587              pattern; otherwise help for all the builtins and  shell  control
588              structures  is printed.  The -s option restricts the information
589              displayed to a short usage synopsis.  The  return  status  is  0
590              unless no command matches pattern.
591
592       history [n]
593       history -c
594       history -d offset
595       history -anrw [filename]
596       history -p arg [arg ...]
597       history -s arg [arg ...]
598              With no options, display the command history list with line num‐
599              bers.  Lines listed with a * have been modified.  An argument of
600              n  lists only the last n lines.  If the shell variable HISTTIME‐
601              FORMAT is set and not null, it is used as a  format  string  for
602              strftime(3)  to display the time stamp associated with each dis‐
603              played history entry.  No intervening blank is  printed  between
604              the  formatted  time stamp and the history line.  If filename is
605              supplied, it is used as the name of the history  file;  if  not,
606              the  value  of HISTFILE is used.  Options, if supplied, have the
607              following meanings:
608              -c     Clear the history list by deleting all the entries.
609              -d offset
610                     Delete the history entry at position offset.
611              -a     Append the ``new'' history lines (history  lines  entered
612                     since  the  beginning of the current bash session) to the
613                     history file.
614              -n     Read the history lines not already read from the  history
615                     file  into  the  current  history  list.  These are lines
616                     appended to the history file since the beginning  of  the
617                     current bash session.
618              -r     Read the contents of the history file and use them as the
619                     current history.
620              -w     Write the current history to the history file,  overwrit‐
621                     ing the history file's contents.
622              -p     Perform  history  substitution  on the following args and
623                     display the result on  the  standard  output.   Does  not
624                     store  the results in the history list.  Each arg must be
625                     quoted to disable normal history expansion.
626              -s     Store the args in the history list  as  a  single  entry.
627                     The  last  command  in the history list is removed before
628                     the args are added.
629
630              If the HISTTIMEFORMAT is set, the time stamp information associ‐
631              ated  with  each  history  entry is written to the history file.
632              The return value is 0 unless an invalid option  is  encountered,
633              an  error  occurs  while reading or writing the history file, an
634              invalid offset is supplied as an argument to -d, or the  history
635              expansion supplied as an argument to -p fails.
636
637       jobs [-lnprs] [ jobspec ... ]
638       jobs -x command [ args ... ]
639              The first form lists the active jobs.  The options have the fol‐
640              lowing meanings:
641              -l     List process IDs in addition to the normal information.
642              -p     List only the process  ID  of  the  job's  process  group
643                     leader.
644              -n     Display  information  only  about  jobs that have changed
645                     status since the user was last notified of their status.
646              -r     Restrict output to running jobs.
647              -s     Restrict output to stopped jobs.
648
649              If jobspec is given, output is restricted to  information  about
650              that  job.   The  return status is 0 unless an invalid option is
651              encountered or an invalid jobspec is supplied.
652
653              If the -x option is supplied, jobs replaces any jobspec found in
654              command  or  args  with  the corresponding process group ID, and
655              executes command passing it args, returning its exit status.
656
657       kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ...
658       kill -l [sigspec | exit_status]
659              Send the signal named by sigspec  or  signum  to  the  processes
660              named  by  pid or jobspec.  sigspec is either a case-insensitive
661              signal name such as SIGKILL (with or without the SIG prefix)  or
662              a  signal  number; signum is a signal number.  If sigspec is not
663              present, then SIGTERM is assumed.  An argument of -l  lists  the
664              signal  names.   If any arguments are supplied when -l is given,
665              the names of the signals  corresponding  to  the  arguments  are
666              listed, and the return status is 0.  The exit_status argument to
667              -l is a number specifying either a signal  number  or  the  exit
668              status  of  a process terminated by a signal.  kill returns true
669              if at least one signal was successfully sent,  or  false  if  an
670              error occurs or an invalid option is encountered.
671
672       let arg [arg ...]
673              Each arg is an arithmetic expression to be evaluated (see ARITH‐
674              METIC EVALUATION).  If the last arg evaluates to 0, let  returns
675              1; 0 is returned otherwise.
676
677       local [option] [name[=value] ...]
678              For  each  argument, a local variable named name is created, and
679              assigned value.  The option can be any of the  options  accepted
680              by declare.  When local is used within a function, it causes the
681              variable name to have a visible scope restricted to  that  func‐
682              tion and its children.  With no operands, local writes a list of
683              local variables to the standard output.  It is an error  to  use
684              local when not within a function.  The return status is 0 unless
685              local is used outside a function, an invalid name  is  supplied,
686              or name is a readonly variable.
687
688       logout Exit a login shell.
689
690       popd [-n] [+n] [-n]
691              Removes  entries  from  the directory stack.  With no arguments,
692              removes the top directory from the stack, and performs a  cd  to
693              the new top directory.  Arguments, if supplied, have the follow‐
694              ing meanings:
695              +n     Removes the nth entry counting from the left of the  list
696                     shown  by  dirs, starting with zero.  For example: ``popd
697                     +0'' removes the first directory, ``popd +1'' the second.
698              -n     Removes the nth entry counting from the right of the list
699                     shown  by  dirs, starting with zero.  For example: ``popd
700                     -0'' removes the last directory, ``popd -1'' the next  to
701                     last.
702              -n     Suppresses  the  normal change of directory when removing
703                     directories from the stack, so that  only  the  stack  is
704                     manipulated.
705
706              If  the popd command is successful, a dirs is performed as well,
707              and the return status is 0.  popd returns false  if  an  invalid
708              option is encountered, the directory stack is empty, a non-exis‐
709              tent directory stack entry is specified, or the directory change
710              fails.
711
712       printf [-v var] format [arguments]
713              Write  the  formatted arguments to the standard output under the
714              control of the format.  The format is a character  string  which
715              contains  three  types  of  objects: plain characters, which are
716              simply copied to standard output,  character  escape  sequences,
717              which  are converted and copied to the standard output, and for‐
718              mat specifications, each of which causes printing  of  the  next
719              successive argument.  In addition to the standard printf(1) for‐
720              mats, %b causes printf to expand backslash escape  sequences  in
721              the  corresponding  argument  (except that \c terminates output,
722              backslashes in \', \", and \? are not removed, and octal escapes
723              beginning  with \0 may contain up to four digits), and %q causes
724              printf to output the corresponding argument in a format that can
725              be reused as shell input.
726
727              The  -v  option causes the output to be assigned to the variable
728              var rather than being printed to the standard output.
729
730              The format is reused as necessary to consume all  of  the  argu‐
731              ments.  If the format requires more arguments than are supplied,
732              the extra format specifications behave as if  a  zero  value  or
733              null  string,  as  appropriate,  had  been supplied.  The return
734              value is zero on success, non-zero on failure.
735
736       pushd [-n] [dir]
737       pushd [-n] [+n] [-n]
738              Adds a directory to the top of the directory stack,  or  rotates
739              the  stack,  making the new top of the stack the current working
740              directory.  With no arguments, exchanges the top two directories
741              and  returns 0, unless the directory stack is empty.  Arguments,
742              if supplied, have the following meanings:
743              +n     Rotates the stack so that  the  nth  directory  (counting
744                     from  the  left  of the list shown by dirs, starting with
745                     zero) is at the top.
746              -n     Rotates the stack so that  the  nth  directory  (counting
747                     from  the  right of the list shown by dirs, starting with
748                     zero) is at the top.
749              -n     Suppresses the normal change  of  directory  when  adding
750                     directories  to  the  stack,  so  that  only the stack is
751                     manipulated.
752              dir    Adds dir to the directory stack at the top, making it the
753                     new current working directory.
754
755              If the pushd command is successful, a dirs is performed as well.
756              If the first form is used, pushd returns 0 unless the cd to  dir
757              fails.   With the second form, pushd returns 0 unless the direc‐
758              tory stack is empty, a non-existent directory stack  element  is
759              specified,  or the directory change to the specified new current
760              directory fails.
761
762       pwd [-LP]
763              Print the absolute pathname of the  current  working  directory.
764              The pathname printed contains no symbolic links if the -P option
765              is supplied or the -o physical option to the set builtin command
766              is  enabled.  If the -L option is used, the pathname printed may
767              contain symbolic links.  The return status is 0 unless an  error
768              occurs  while  reading  the  name of the current directory or an
769              invalid option is supplied.
770
771       read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d
772       delim] [name ...]
773              One  line  is  read  from  the  standard input, or from the file
774              descriptor fd supplied as an argument to the -u option, and  the
775              first word is assigned to the first name, the second word to the
776              second name, and so on, with leftover words and their  interven‐
777              ing  separators  assigned  to the last name.  If there are fewer
778              words read from the input stream than names, the remaining names
779              are  assigned  empty  values.  The characters in IFS are used to
780              split the line into words.  The backslash character (\)  may  be
781              used  to  remove any special meaning for the next character read
782              and for line continuation.  Options, if supplied, have the  fol‐
783              lowing meanings:
784              -a aname
785                     The words are assigned to sequential indices of the array
786                     variable aname, starting at 0.  aname is unset before any
787                     new  values  are  assigned.   Other  name  arguments  are
788                     ignored.
789              -d delim
790                     The first character of delim is  used  to  terminate  the
791                     input line, rather than newline.
792              -e     If the standard input is coming from a terminal, readline
793                     (see READLINE above) is used to obtain the line.
794              -n nchars
795                     read returns after reading nchars characters rather  than
796                     waiting for a complete line of input.
797              -p prompt
798                     Display prompt on standard error, without a trailing new‐
799                     line, before attempting to read any input.  The prompt is
800                     displayed only if input is coming from a terminal.
801              -r     Backslash does not act as an escape character.  The back‐
802                     slash is considered to be part of the line.  In  particu‐
803                     lar,  a  backslash-newline pair may not be used as a line
804                     continuation.
805              -s     Silent mode.  If input is coming from a terminal, charac‐
806                     ters are not echoed.
807              -t timeout
808                     Cause  read  to time out and return failure if a complete
809                     line of input is not read within timeout  seconds.   This
810                     option  has  no  effect if read is not reading input from
811                     the terminal or a pipe.
812              -u fd  Read input from file descriptor fd.
813
814              If no names are supplied, the line read is assigned to the vari‐
815              able  REPLY.   The  return  code  is zero, unless end-of-file is
816              encountered, read times out, or an invalid  file  descriptor  is
817              supplied as the argument to -u.
818
819       readonly [-apf] [name[=word] ...]
820              The  given  names are marked readonly; the values of these names
821              may not be changed by subsequent assignment.  If the  -f  option
822              is  supplied,  the  functions  corresponding to the names are so
823              marked.  The -a option restricts the variables to arrays.  If no
824              name  arguments  are  given,  or if the -p option is supplied, a
825              list of all readonly names is printed.   The  -p  option  causes
826              output  to be displayed in a format that may be reused as input.
827              If a variable name is followed by =word, the value of the  vari‐
828              able  is  set to word.  The return status is 0 unless an invalid
829              option is encountered, one of the names is  not  a  valid  shell
830              variable name, or -f is supplied with a name that is not a func‐
831              tion.
832
833       return [n]
834              Causes a function to exit with the return value specified by  n.
835              If  n  is omitted, the return status is that of the last command
836              executed in the function body.  If used outside a function,  but
837              during  execution  of  a  script  by the .  (source) command, it
838              causes the shell to stop executing that script and return either
839              n  or  the  exit  status of the last command executed within the
840              script as the exit status of the  script.   If  used  outside  a
841              function  and  not during execution of a script by ., the return
842              status is false.  Any command associated with the RETURN trap is
843              executed before execution resumes after the function or script.
844
845       set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
846              Without  options,  the name and value of each shell variable are
847              displayed in a format that can be reused as input for setting or
848              resetting the currently-set variables.  Read-only variables can‐
849              not be reset.  In posix mode, only shell variables  are  listed.
850              The  output  is  sorted  according  to the current locale.  When
851              options are specified, they set or unset shell attributes.   Any
852              arguments  remaining after the options are processed are treated
853              as values for the positional parameters  and  are  assigned,  in
854              order, to $1, $2, ...  $n.  Options, if specified, have the fol‐
855              lowing meanings:
856              -a      Automatically mark variables  and  functions  which  are
857                      modified  or  created  for  export to the environment of
858                      subsequent commands.
859              -b      Report the status of terminated background jobs  immedi‐
860                      ately, rather than before the next primary prompt.  This
861                      is effective only when job control is enabled.
862              -e      Exit immediately if a simple command (see SHELL  GRAMMAR
863                      above) exits with a non-zero status.  The shell does not
864                      exit if the command that fails is part  of  the  command
865                      list  immediately  following  a  while or until keyword,
866                      part of the test in an if statement, part of a && or  ⎪⎪
867                      list, or if the command's return value is being inverted
868                      via !.  A trap on ERR, if set, is  executed  before  the
869                      shell exits.
870              -f      Disable pathname expansion.
871              -h      Remember  the location of commands as they are looked up
872                      for execution.  This is enabled by default.
873              -k      All arguments in the form of assignment  statements  are
874                      placed  in the environment for a command, not just those
875                      that precede the command name.
876              -m      Monitor mode.  Job control is enabled.  This  option  is
877                      on  by  default  for  interactive shells on systems that
878                      support it (see JOB  CONTROL  above).   Background  pro‐
879                      cesses  run  in a separate process group and a line con‐
880                      taining their exit status is printed upon their  comple‐
881                      tion.
882              -n      Read commands but do not execute them.  This may be used
883                      to check a shell script  for  syntax  errors.   This  is
884                      ignored by interactive shells.
885              -o option-name
886                      The option-name can be one of the following:
887                      allexport
888                              Same as -a.
889                      braceexpand
890                              Same as -B.
891                      emacs   Use  an  emacs-style command line editing inter‐
892                              face.  This is enabled by default when the shell
893                              is interactive, unless the shell is started with
894                              the --noediting option.
895                      errtrace
896                              Same as -E.
897                      functrace
898                              Same as -T.
899                      errexit Same as -e.
900                      hashall Same as -h.
901                      histexpand
902                              Same as -H.
903                      history Enable command history, as described above under
904                              HISTORY.  This option is on by default in inter‐
905                              active shells.
906                      ignoreeof
907                              The  effect  is  as   if   the   shell   command
908                              ``IGNOREEOF=10''  had  been  executed (see Shell
909                              Variables above).
910                      keyword Same as -k.
911                      monitor Same as -m.
912                      noclobber
913                              Same as -C.
914                      noexec  Same as -n.
915                      noglob  Same as -f.  nolog Currently ignored.
916                      notify  Same as -b.
917                      nounset Same as -u.
918                      onecmd  Same as -t.
919                      physical
920                              Same as -P.
921                      pipefail
922                              If set, the return value of a  pipeline  is  the
923                              value  of  the  last (rightmost) command to exit
924                              with a non-zero status, or zero if all  commands
925                              in  the pipeline exit successfully.  This option
926                              is disabled by default.
927                      posix   Change the behavior of bash  where  the  default
928                              operation  differs  from  the  POSIX standard to
929                              match the standard (posix mode).
930                      privileged
931                              Same as -p.
932                      verbose Same as -v.
933                      vi      Use a vi-style command line editing interface.
934                      xtrace  Same as -x.
935                      If -o is supplied with no option-name, the values of the
936                      current  options are printed.  If +o is supplied with no
937                      option-name, a series of set commands  to  recreate  the
938                      current  option  settings  is  displayed on the standard
939                      output.
940              -p      Turn on privileged mode.  In this  mode,  the  $ENV  and
941                      $BASH_ENV  files  are not processed, shell functions are
942                      not inherited from the environment,  and  the  SHELLOPTS
943                      variable,  if it appears in the environment, is ignored.
944                      If the shell is started with the effective user  (group)
945                      id  not  equal  to  the real user (group) id, and the -p
946                      option is not supplied, these actions are taken and  the
947                      effective user id is set to the real user id.  If the -p
948                      option is supplied at startup, the effective user id  is
949                      not reset.  Turning this option off causes the effective
950                      user and group ids to be set to the real user and  group
951                      ids.
952              -t      Exit after reading and executing one command.
953              -u      Treat unset variables as an error when performing param‐
954                      eter expansion.  If expansion is attempted on  an  unset
955                      variable, the shell prints an error message, and, if not
956                      interactive, exits with a non-zero status.
957              -v      Print shell input lines as they are read.
958              -x      After expanding each simple command, for  command,  case
959                      command, select command, or arithmetic for command, dis‐
960                      play the expanded value of PS4, followed by the  command
961                      and its expanded arguments or associated word list.
962              -B      The  shell performs brace expansion (see Brace Expansion
963                      above).  This is on by default.
964              -C      If set, bash does not overwrite an  existing  file  with
965                      the  >,  >&,  and <> redirection operators.  This may be
966                      overridden when creating output files by using the redi‐
967                      rection operator >| instead of >.
968              -E      If set, any trap on ERR is inherited by shell functions,
969                      command substitutions, and commands executed in  a  sub‐
970                      shell  environment.  The ERR trap is normally not inher‐
971                      ited in such cases.
972              -H      Enable !  style history substitution.  This option is on
973                      by default when the shell is interactive.
974              -P      If  set,  the  shell does not follow symbolic links when
975                      executing commands such as cd that  change  the  current
976                      working  directory.   It  uses  the  physical  directory
977                      structure instead.  By default, bash follows the logical
978                      chain  of  directories  when  performing  commands which
979                      change the current directory.
980              -T      If set, any traps on DEBUG and RETURN are  inherited  by
981                      shell  functions,  command  substitutions,  and commands
982                      executed in  a  subshell  environment.   The  DEBUG  and
983                      RETURN traps are normally not inherited in such cases.
984              --      If  no arguments follow this option, then the positional
985                      parameters are unset.  Otherwise, the positional parame‐
986                      ters  are  set  to  the args, even if some of them begin
987                      with a -.
988              -       Signal the end of options, cause all remaining  args  to
989                      be assigned to the positional parameters.  The -x and -v
990                      options are turned off.  If there are no args, the posi‐
991                      tional parameters remain unchanged.
992
993              The  options are off by default unless otherwise noted.  Using +
994              rather than - causes  these  options  to  be  turned  off.   The
995              options  can  also be specified as arguments to an invocation of
996              the shell.  The current set of options may be found in $-.   The
997              return status is always true unless an invalid option is encoun‐
998              tered.
999
1000       shift [n]
1001              The positional parameters from n+1 ... are renamed  to  $1  ....
1002              Parameters  represented  by  the  numbers  $# down to $#-n+1 are
1003              unset.  n must be a non-negative number less than  or  equal  to
1004              $#.   If  n is 0, no parameters are changed.  If n is not given,
1005              it is assumed to be 1.  If n is greater than $#, the  positional
1006              parameters  are  not changed.  The return status is greater than
1007              zero if n is greater than $# or less than zero; otherwise 0.
1008
1009       shopt [-pqsu] [-o] [optname ...]
1010              Toggle the values of variables controlling optional shell behav‐
1011              ior.  With no options, or with the -p option, a list of all set‐
1012              table options is displayed, with an indication of whether or not
1013              each  is  set.  The -p option causes output to be displayed in a
1014              form that may be reused as input.  Other options have  the  fol‐
1015              lowing meanings:
1016              -s     Enable (set) each optname.
1017              -u     Disable (unset) each optname.
1018              -q     Suppresses  normal output (quiet mode); the return status
1019                     indicates whether the optname is set or unset.  If multi‐
1020                     ple  optname arguments are given with -q, the return sta‐
1021                     tus is zero if all optnames are enabled; non-zero  other‐
1022                     wise.
1023              -o     Restricts  the  values of optname to be those defined for
1024                     the -o option to the set builtin.
1025
1026              If either -s or -u is used with no optname arguments,  the  dis‐
1027              play is limited to those options which are set or unset, respec‐
1028              tively.  Unless otherwise noted, the shopt options are  disabled
1029              (unset) by default.
1030
1031              The  return  status when listing options is zero if all optnames
1032              are enabled, non-zero  otherwise.   When  setting  or  unsetting
1033              options,  the  return  status is zero unless an optname is not a
1034              valid shell option.
1035
1036              The list of shopt options is:
1037
1038              cdable_vars
1039                      If set, an argument to the cd builtin  command  that  is
1040                      not  a directory is assumed to be the name of a variable
1041                      whose value is the directory to change to.
1042              cdspell If set, minor errors in the spelling of a directory com‐
1043                      ponent  in  a  cd command will be corrected.  The errors
1044                      checked for are transposed characters, a missing charac‐
1045                      ter,  and  one  character  too many.  If a correction is
1046                      found, the corrected file name is printed, and the  com‐
1047                      mand  proceeds.  This option is only used by interactive
1048                      shells.
1049              checkhash
1050                      If set, bash checks that a command found in the hash ta‐
1051                      ble  exists  before  trying  to execute it.  If a hashed
1052                      command no longer exists, a normal path search  is  per‐
1053                      formed.
1054              checkwinsize
1055                      If  set,  bash checks the window size after each command
1056                      and, if necessary, updates the values of LINES and  COL‐
1057                      UMNS.
1058              cmdhist If  set,  bash attempts to save all lines of a multiple-
1059                      line command in the same  history  entry.   This  allows
1060                      easy re-editing of multi-line commands.
1061              dotglob If  set, bash includes filenames beginning with a `.' in
1062                      the results of pathname expansion.
1063              execfail
1064                      If set, a non-interactive shell will not exit if it can‐
1065                      not  execute  the  file  specified as an argument to the
1066                      exec builtin command.  An  interactive  shell  does  not
1067                      exit if exec fails.
1068              expand_aliases
1069                      If  set,  aliases  are expanded as described above under
1070                      ALIASES.  This option is enabled by default for interac‐
1071                      tive shells.
1072              extdebug
1073                      If  set,  behavior  intended  for  use  by  debuggers is
1074                      enabled:
1075                      1.     The -F option to the declare builtin displays the
1076                             source file name and line number corresponding to
1077                             each function name supplied as an argument.
1078                      2.     If the command run by the DEBUG  trap  returns  a
1079                             non-zero  value,  the next command is skipped and
1080                             not executed.
1081                      3.     If the command run by the DEBUG  trap  returns  a
1082                             value  of 2, and the shell is executing in a sub‐
1083                             routine (a shell function or a shell script  exe‐
1084                             cuted  by  the  .  or source builtins), a call to
1085                             return is simulated.
1086                      4.     BASH_ARGC and BASH_ARGV are updated as  described
1087                             in their descriptions above.
1088                      5.     Function  tracing  is enabled:  command substitu‐
1089                             tion, shell functions, and subshells invoked with
1090                             ( command ) inherit the DEBUG and RETURN traps.
1091                      6.     Error  tracing is enabled:  command substitution,
1092                             shell functions, and  subshells  invoked  with  (
1093                             command ) inherit the ERROR trap.
1094              extglob If set, the extended pattern matching features described
1095                      above under Pathname Expansion are enabled.
1096              extquote
1097                      If set, $'string' and  $"string"  quoting  is  performed
1098                      within   ${parameter}   expansions  enclosed  in  double
1099                      quotes.  This option is enabled by default.
1100              failglob
1101                      If set, patterns which fail to  match  filenames  during
1102                      pathname expansion result in an expansion error.
1103              force_fignore
1104                      If  set,  the  suffixes  specified  by the FIGNORE shell
1105                      variable cause words to be ignored when performing  word
1106                      completion even if the ignored words are the only possi‐
1107                      ble  completions.   See  SHELL  VARIABLES  above  for  a
1108                      description  of  FIGNORE.   This  option  is  enabled by
1109                      default.
1110              gnu_errfmt
1111                      If set, shell error messages are written in the standard
1112                      GNU error message format.
1113              histappend
1114                      If  set,  the history list is appended to the file named
1115                      by the value of the HISTFILE  variable  when  the  shell
1116                      exits, rather than overwriting the file.
1117              histreedit
1118                      If  set, and readline is being used, a user is given the
1119                      opportunity to re-edit a failed history substitution.
1120              histverify
1121                      If set, and readline is being used, the results of  his‐
1122                      tory  substitution  are  not  immediately  passed to the
1123                      shell parser.  Instead, the  resulting  line  is  loaded
1124                      into the readline editing buffer, allowing further modi‐
1125                      fication.
1126              hostcomplete
1127                      If set, and readline is being used, bash will attempt to
1128                      perform  hostname  completion when a word containing a @
1129                      is  being  completed  (see  Completing  under   READLINE
1130                      above).  This is enabled by default.
1131              huponexit
1132                      If set, bash will send SIGHUP to all jobs when an inter‐
1133                      active login shell exits.
1134              interactive_comments
1135                      If set, allow a word beginning with # to cause that word
1136                      and  all remaining characters on that line to be ignored
1137                      in an interactive  shell  (see  COMMENTS  above).   This
1138                      option is enabled by default.
1139              lithist If  set,  and  the cmdhist option is enabled, multi-line
1140                      commands are saved to the history with embedded newlines
1141                      rather than using semicolon separators where possible.
1142              login_shell
1143                      The  shell  sets this option if it is started as a login
1144                      shell (see INVOCATION above).   The  value  may  not  be
1145                      changed.
1146              mailwarn
1147                      If  set,  and  a file that bash is checking for mail has
1148                      been accessed since the last time it  was  checked,  the
1149                      message  ``The  mail in mailfile has been read'' is dis‐
1150                      played.
1151              no_empty_cmd_completion
1152                      If set, and  readline  is  being  used,  bash  will  not
1153                      attempt to search the PATH for possible completions when
1154                      completion is attempted on an empty line.
1155              nocaseglob
1156                      If set, bash matches  filenames  in  a  case-insensitive
1157                      fashion when performing pathname expansion (see Pathname
1158                      Expansion above).
1159              nocasematch
1160                      If set, bash  matches  patterns  in  a  case-insensitive
1161                      fashion when performing matching while executing case or
1162                      [[ conditional commands.
1163              nullglob
1164                      If set, bash allows patterns which match no  files  (see
1165                      Pathname  Expansion  above)  to expand to a null string,
1166                      rather than themselves.
1167              progcomp
1168                      If set, the programmable completion facilities (see Pro‐
1169                      grammable Completion above) are enabled.  This option is
1170                      enabled by default.
1171              promptvars
1172                      If set, prompt strings undergo parameter expansion, com‐
1173                      mand   substitution,  arithmetic  expansion,  and  quote
1174                      removal after being expanded as described  in  PROMPTING
1175                      above.  This option is enabled by default.
1176              restricted_shell
1177                      The   shell  sets  this  option  if  it  is  started  in
1178                      restricted mode (see RESTRICTED SHELL below).  The value
1179                      may  not be changed.  This is not reset when the startup
1180                      files are executed, allowing the startup files  to  dis‐
1181                      cover whether or not a shell is restricted.
1182              shift_verbose
1183                      If  set,  the shift builtin prints an error message when
1184                      the shift count exceeds the number of positional parame‐
1185                      ters.
1186              sourcepath
1187                      If set, the source (.) builtin uses the value of PATH to
1188                      find the directory containing the file  supplied  as  an
1189                      argument.  This option is enabled by default.
1190              xpg_echo
1191                      If   set,  the  echo  builtin  expands  backslash-escape
1192                      sequences by default.
1193       suspend [-f]
1194              Suspend the execution of this shell until it receives a  SIGCONT
1195              signal.   The  -f option says not to complain if this is a login
1196              shell; just suspend anyway.  The return status is 0  unless  the
1197              shell is a login shell and -f is not supplied, or if job control
1198              is not enabled.
1199       test expr
1200       [ expr ]
1201              Return a status of 0 or 1 depending on  the  evaluation  of  the
1202              conditional  expression expr.  Each operator and operand must be
1203              a separate argument.  Expressions are composed of the  primaries
1204              described  above  under  CONDITIONAL EXPRESSIONS.  test does not
1205              accept any options, nor does it accept and ignore an argument of
1206              -- as signifying the end of options.
1207
1208              Expressions  may  be  combined  using  the  following operators,
1209              listed in decreasing order of precedence.
1210              ! expr True if expr is false.
1211              ( expr )
1212                     Returns the value of expr.  This may be used to  override
1213                     the normal precedence of operators.
1214              expr1 -a expr2
1215                     True if both expr1 and expr2 are true.
1216              expr1 -o expr2
1217                     True if either expr1 or expr2 is true.
1218
1219              test and [ evaluate conditional expressions using a set of rules
1220              based on the number of arguments.
1221
1222              0 arguments
1223                     The expression is false.
1224              1 argument
1225                     The expression is true if and only if the argument is not
1226                     null.
1227              2 arguments
1228                     If the first argument is !, the expression is true if and
1229                     only if the second argument is null.  If the first  argu‐
1230                     ment  is  one  of  the unary conditional operators listed
1231                     above under CONDITIONAL EXPRESSIONS,  the  expression  is
1232                     true if the unary test is true.  If the first argument is
1233                     not a valid unary conditional operator, the expression is
1234                     false.
1235              3 arguments
1236                     If  the  second argument is one of the binary conditional
1237                     operators listed above under CONDITIONAL EXPRESSIONS, the
1238                     result of the expression is the result of the binary test
1239                     using the first and third arguments as operands.  If  the
1240                     first  argument  is  !,  the value is the negation of the
1241                     two-argument test using the second and  third  arguments.
1242                     If the first argument is exactly ( and the third argument
1243                     is exactly ), the result is the one-argument test of  the
1244                     second  argument.   Otherwise,  the  expression is false.
1245                     The -a and -o operators are considered  binary  operators
1246                     in this case.
1247              4 arguments
1248                     If the first argument is !, the result is the negation of
1249                     the three-argument expression composed of  the  remaining
1250                     arguments.  Otherwise, the expression is parsed and eval‐
1251                     uated according to  precedence  using  the  rules  listed
1252                     above.
1253              5 or more arguments
1254                     The  expression  is  parsed  and  evaluated  according to
1255                     precedence using the rules listed above.
1256
1257       times  Print the accumulated user and system times for  the  shell  and
1258              for processes run from the shell.  The return status is 0.
1259
1260       trap [-lp] [[arg] sigspec ...]
1261              The  command  arg  is  to  be  read  and executed when the shell
1262              receives signal(s) sigspec.  If arg is absent (and  there  is  a
1263              single  sigspec)  or  -,  each  specified signal is reset to its
1264              original disposition (the value it  had  upon  entrance  to  the
1265              shell).   If arg is the null string the signal specified by each
1266              sigspec is ignored by the shell and by the commands it  invokes.
1267              If  arg  is  not present and -p has been supplied, then the trap
1268              commands associated with each  sigspec  are  displayed.   If  no
1269              arguments  are  supplied or if only -p is given, trap prints the
1270              list of commands associated with each  signal.   The  -l  option
1271              causes  the shell to print a list of signal names and their cor‐
1272              responding numbers.   Each  sigspec  is  either  a  signal  name
1273              defined  in  <signal.h>,  or  a signal number.  Signal names are
1274              case insensitive and the SIG prefix is optional.  If  a  sigspec
1275              is  EXIT (0) the command arg is executed on exit from the shell.
1276              If a sigspec is DEBUG, the command arg is executed before  every
1277              simple command, for command, case command, select command, every
1278              arithmetic for command, and before the first command executes in
1279              a  shell  function  (see  SHELL  GRAMMAR  above).   Refer to the
1280              description of the extdebug option  to  the  shopt  builtin  for
1281              details  of  its effect on the DEBUG trap.  If a sigspec is ERR,
1282              the command arg is executed whenever  a  simple  command  has  a
1283              non-zero  exit status, subject to the following conditions.  The
1284              ERR trap is not executed if the failed command is  part  of  the
1285              command  list  immediately  following  a while or until keyword,
1286              part of the test in an if statement, part of a && or ⎪⎪ list, or
1287              if  the  command's  return value is being inverted via !.  These
1288              are the same conditions obeyed by  the  errexit  option.   If  a
1289              sigspec is RETURN, the command arg is executed each time a shell
1290              function or a script executed with the . or source builtins fin‐
1291              ishes executing.  Signals ignored upon entry to the shell cannot
1292              be trapped or reset.  Trapped signals that are not being ignored
1293              are reset to their original values in a child process when it is
1294              created.  The return status is false if any sigspec is  invalid;
1295              otherwise trap returns true.
1296
1297       type [-aftpP] name [name ...]
1298              With  no options, indicate how each name would be interpreted if
1299              used as a command name.  If the -t option is used, type prints a
1300              string  which  is  one  of alias, keyword, function, builtin, or
1301              file if  name  is  an  alias,  shell  reserved  word,  function,
1302              builtin,  or disk file, respectively.  If the name is not found,
1303              then nothing  is  printed,  and  an  exit  status  of  false  is
1304              returned.   If  the  -p  option is used, type either returns the
1305              name of the disk file that would be executed if name were speci‐
1306              fied as a command name, or nothing if ``type -t name'' would not
1307              return file.  The -P option forces a PATH search for each  name,
1308              even if ``type -t name'' would not return file.  If a command is
1309              hashed, -p and -P print the hashed value,  not  necessarily  the
1310              file that appears first in PATH.  If the -a option is used, type
1311              prints all of the places that contain an executable named  name.
1312              This  includes  aliases  and  functions,  if  and only if the -p
1313              option is not also used.  The table of hashed  commands  is  not
1314              consulted  when  using -a.  The -f option suppresses shell func‐
1315              tion lookup, as with the command builtin.  type returns true  if
1316              any of the arguments are found, false if none are found.
1317
1318       ulimit [-SHacdefilmnpqrstuvx [limit]]
1319              Provides  control  over the resources available to the shell and
1320              to processes started by it, on systems that allow such  control.
1321              The -H and -S options specify that the hard or soft limit is set
1322              for the given resource.  A hard limit cannot be  increased  once
1323              it  is set; a soft limit may be increased up to the value of the
1324              hard limit.  If neither -H nor -S is specified,  both  the  soft
1325              and  hard limits are set.  The value of limit can be a number in
1326              the unit specified for the resource or one of the special values
1327              hard,  soft,  or  unlimited,  which  stand  for the current hard
1328              limit, the current soft limit, and no limit,  respectively.   If
1329              limit  is  omitted,  the  current value of the soft limit of the
1330              resource is printed, unless the -H option is given.   When  more
1331              than  one  resource  is  specified,  the limit name and unit are
1332              printed before the value.  Other options are interpreted as fol‐
1333              lows:
1334              -a     All current limits are reported
1335              -c     The maximum size of core files created
1336              -d     The maximum size of a process's data segment
1337              -e     The maximum scheduling priority ("nice")
1338              -f     The  maximum  size  of files written by the shell and its
1339                     children
1340              -i     The maximum number of pending signals
1341              -l     The maximum size that may be locked into memory
1342              -m     The maximum resident set size (has no effect on Linux)
1343              -n     The maximum number of open file descriptors (most systems
1344                     do not allow this value to be set)
1345              -p     The pipe size in 512-byte blocks (this may not be set)
1346              -q     The maximum number of bytes in POSIX message queues
1347              -r     The maximum real-time scheduling priority
1348              -s     The maximum stack size
1349              -t     The maximum amount of cpu time in seconds
1350              -u     The  maximum  number  of  processes available to a single
1351                     user
1352              -v     The maximum amount of virtual  memory  available  to  the
1353                     shell
1354              -x     The maximum number of file locks
1355
1356              If limit is given, it is the new value of the specified resource
1357              (the -a option is display only).  If no option is given, then -f
1358              is  assumed.  Values are in 1024-byte increments, except for -t,
1359              which is in seconds, -p, which is in units of  512-byte  blocks,
1360              and  -n and -u, which are unscaled values.  The return status is
1361              0 unless an invalid option or argument is supplied, or an  error
1362              occurs while setting a new limit.
1363
1364       umask [-p] [-S] [mode]
1365              The user file-creation mask is set to mode.  If mode begins with
1366              a digit, it is interpreted as an octal number; otherwise  it  is
1367              interpreted  as a symbolic mode mask similar to that accepted by
1368              chmod(1).  If mode is omitted, the current value of the mask  is
1369              printed.   The  -S  option causes the mask to be printed in sym‐
1370              bolic form; the default output is an octal number.   If  the  -p
1371              option is supplied, and mode is omitted, the output is in a form
1372              that may be reused as input.  The return status is 0 if the mode
1373              was  successfully  changed  or if no mode argument was supplied,
1374              and false otherwise.
1375
1376       unalias [-a] [name ...]
1377              Remove each name from the list of defined  aliases.   If  -a  is
1378              supplied,  all  alias definitions are removed.  The return value
1379              is true unless a supplied name is not a defined alias.
1380
1381       unset [-fv] [name ...]
1382              For each name, remove the corresponding  variable  or  function.
1383              If no options are supplied, or the -v option is given, each name
1384              refers to a shell variable.   Read-only  variables  may  not  be
1385              unset.   If  -f  is specified, each name refers to a shell func‐
1386              tion, and the function definition is removed.  Each unset  vari‐
1387              able  or function is removed from the environment passed to sub‐
1388              sequent commands.  If any of RANDOM, SECONDS,  LINENO,  HISTCMD,
1389              FUNCNAME, GROUPS, or DIRSTACK are unset, they lose their special
1390              properties, even if they are subsequently reset.  The exit  sta‐
1391              tus is true unless a name is readonly.
1392
1393       wait [n ...]
1394              Wait  for each specified process and return its termination sta‐
1395              tus.  Each n may be a process ID or a job  specification;  if  a
1396              job  spec  is  given,  all  processes in that job's pipeline are
1397              waited for.  If n is not given, all currently active child  pro‐
1398              cesses  are  waited  for,  and  the return status is zero.  If n
1399              specifies a non-existent process or job, the  return  status  is
1400              127.   Otherwise,  the  return  status is the exit status of the
1401              last process or job waited for.
1402

SEE ALSO

1404       bash(1), sh(1)
1405
1406
1407
1408GNU Bash-3.0                      2004 Apr 20                 BASH_BUILTINS(1)
Impressum